import request from '@/config/axios'

export interface AccountVO {
  id: number
  channelId: number
  name: string
  accountId: string
  apiKey: string
  apiSecret: string
}

// 查询广告账号列表
export const getAccountPage = async (params) => {
  return await request.get({ url: `/ad/account/page`, params })
}

// 查询广告账号simple列表
export const getAccountSimpleList = async () => {
  return await request.get({ url: `/ad/account/simple-list` })
}

// 查询广告账号详情
export const getAccount = async (id: number) => {
  return await request.get({ url: `/ad/account/get?id=` + id })
}

// 新增广告账号
export const createAccount = async (data: AccountVO) => {
  return await request.post({ url: `/ad/account/create`, data })
}

// 修改广告账号
export const updateAccount = async (data: AccountVO) => {
  return await request.put({ url: `/ad/account/update`, data })
}

// 删除广告账号
export const deleteAccount = async (id: number) => {
  return await request.delete({ url: `/ad/account/delete?id=` + id })
}

// 导出广告账号 Excel
export const exportAccount = async (params) => {
  return await request.download({ url: `/ad/account/export-excel`, params })
}
// 获取授权链接
export const getAuthUrl = async (id) => {
  return await request.get({ url: `/ad/account/get-auth-url?id=` + id })
}

// 获取已授权的广告列表
export const getAdvertiserList = async (params) => {
  return await request.get({ url: `/ad/account/get-advertiser-list`, params })
}
// 获取已授权的广告列表
export const getAdvertiserTreeList = async (params) => {
  return await request.get({ url: `/ad/account/get-advertiser-tree`, params })
}

